package com.czh.mock.exceptions;


import com.czh.mock.exceptions.code.IErrorCodeEnum;

/**
 * 项目的基础异常类，其他业务异常都应该继承这个类
 */
public class XException extends RuntimeException{
    protected int code;

    public XException() {
    }

    public XException (IErrorCodeEnum code) {
        this(code.getCode(), code.getMessage());
    }

    public XException(int code, String message) {
        super(message);
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
